//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package objects;

import common.GlobalID;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;

public class FruitTreeEntry {
    private final String Name;
    private final List<Integer> TimeMin = new ArrayList();
    private final List<Integer> FruitCount = new ArrayList();
    private final String Tool;
    private final Integer Price;
    private final Integer Instance;
    private final String Fruit;
    private final LinkedHashMap<Integer, ProductionsGoodEntry> goodsById = new LinkedHashMap();
    private final LinkedHashMap<String, ProductionsGoodEntry> goodsByName = new LinkedHashMap();

    public FruitTreeEntry(String Name, String Tool, Integer Price, Integer Instance, String Fruit) {
        this.Name = Name;
        this.Tool = Tool;
        this.Price = Price;
        this.Instance = Instance;
        this.Fruit = Fruit;
    }

    public void addStage(Integer timeMin, Integer fruitCount) {
        this.TimeMin.add(timeMin);
        this.FruitCount.add(fruitCount);
    }

    public Integer getTimeMin(int stage) {
        return stage >= 0 && stage < this.TimeMin.size()?(Integer)this.TimeMin.get(stage):null;
    }

    public Integer getFruitCount(int stage) {
        return stage >= 0 && stage < this.FruitCount.size()?(Integer)this.FruitCount.get(stage):null;
    }

    public String getName() {
        return this.Name;
    }

    public String getTool() {
        return this.Tool;
    }

    public Integer getPrice() {
        return this.Price;
    }

    public Integer getInstance() {
        return this.Instance;
    }

    public Integer getGlobalID() {
        return Integer.valueOf(GlobalID.create(62, this.Instance.intValue()));
    }

    public String getFruit() {
        return this.Fruit;
    }

    public Integer getMaxStage() {
        return Integer.valueOf(this.FruitCount.size() - 1);
    }

    public void addGoodEntryWithObjectClass(ProductionsGoodEntry sge, int objectClass, int instance) {
        if(sge.getName() != null) {
            sge.setInstance(instance);
            this.goodsByName.put(sge.getName(), sge);
            this.goodsById.put(sge.getGlobalID(Integer.valueOf(objectClass)), sge);
        }

    }

    public ProductionsGoodEntry getGoodById(Integer id) {
        return (ProductionsGoodEntry)this.goodsById.get(id);
    }

    public ProductionsGoodEntry getGoodByName(String name) {
        return (ProductionsGoodEntry)this.goodsByName.get(name);
    }

    public String toString() {
        return this.Name + "(" + this.getGlobalID() + "): Price:" + this.Price + ", Tool:" + this.Tool + ", Fruit:" + this.Fruit + ", Time:" + this.TimeMin + ", FruitCount:" + this.FruitCount;
    }
}
